package com.hks360.car_treasure.activity;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.view.WindowManager;

import com.hks360.car_treasure.R;
import com.hks360.car_treasure.adapter.FragmentAdapter;
import com.hks360.car_treasure.common.Constant;
import com.hks360.car_treasure.common.PrefKey;
import com.hks360.car_treasure.factory.FragmentFactory;
import com.hks360.library.util.CommonUtil;
import com.hks360.library.util.PrefUtil;
import com.hks360.nohttp.Response;

import net.hks360.viewpagerindicator.TabPageIndicator;

import java.util.ArrayList;
import java.util.List;


/**
 * 注册登录Activity
 */
public class LoginActivity extends BaseActivity {
    private ViewPager mLoginPager;
    private TabPageIndicator mLoginIndicator;

    private List<Fragment> fragments;

    public void initView(){
        setContentView(R.layout.layout_login);
        initFragment();
        setupView();
        initData();
    }

    @Override
    public void setupView() {
        mLoginPager = (ViewPager)findViewById(R.id.login_viewpager);
        mLoginIndicator = (TabPageIndicator)findViewById(R.id.login_tab_indicator);
    }

    @Override
    public void initData() {
        FragmentPagerAdapter adapter = new FragmentAdapter(getSupportFragmentManager(),fragments);
        mLoginPager.setAdapter(adapter);
        mLoginIndicator.setViewPager(mLoginPager);
    }

    @Override
    public void addListener() {

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initView();

    }

    private void initFragment() {
        fragments = new ArrayList<Fragment>();
        Fragment fragment = FragmentFactory.createFragment(Constant.TAG[0]);
        fragments.add(fragment);
        fragment = FragmentFactory.createFragment(Constant.TAG[1]);
        fragments.add(fragment);
    }

    @Override
    public void viewClick(View v) {

    }
}
